package com.hup.sokoban.view.customView.mapListView;

import com.hup.sokoban.view.customView.MapLabel;
import com.hup.utils.swing.customView.ImageButton;

import javax.swing.*;
import java.awt.*;

/**
 * @author hugan
 * @date 2020/5/4
 */
public class PreviewWindowForm {
    public JPanel root;
    public JLabel txtName;
    public JPanel pWinning;
    public JPanel pPlaying;
    public JLabel txtEditTime;
    public JLabel txtDescription;
    public MapLabel mapLabel;

    {
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
// DO NOT EDIT OR ADD ANY CODE HERE!
        $$$setupUI$$$();
    }

    /**
     * Method generated by IntelliJ IDEA GUI Designer
     * >>> IMPORTANT!! <<<
     * DO NOT edit this method OR call it in your code!
     *
     * @noinspection ALL
     */
    private void $$$setupUI$$$() {
        root = new JPanel();
        root.setLayout(new GridBagLayout());
        txtName = new JLabel();
        Font txtNameFont = this.$$$getFont$$$(null, Font.BOLD, 18, txtName.getFont());
        if (txtNameFont != null) txtName.setFont(txtNameFont);
        txtName.setText("name");
        GridBagConstraints gbc;
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 0;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.insets = new Insets(0, 8, 0, 0);
        root.add(txtName, gbc);
        txtDescription = new JLabel();
        txtDescription.setText("description");
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 1;
        gbc.gridwidth = 5;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.insets = new Insets(0, 8, 0, 0);
        root.add(txtDescription, gbc);
        mapLabel = new MapLabel();
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 2;
        gbc.gridwidth = 5;
        gbc.weightx = 1.0;
        gbc.weighty = 1.0;
        gbc.fill = GridBagConstraints.BOTH;
        root.add(mapLabel, gbc);
        txtEditTime = new JLabel();
        txtEditTime.setText("ymd Hms");
        gbc = new GridBagConstraints();
        gbc.gridx = 4;
        gbc.gridy = 0;
        gbc.anchor = GridBagConstraints.WEST;
        root.add(txtEditTime, gbc);
        final JLabel label1 = new JLabel();
        label1.setText("设计时间:");
        gbc = new GridBagConstraints();
        gbc.gridx = 3;
        gbc.gridy = 0;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.insets = new Insets(0, 50, 0, 0);
        root.add(label1, gbc);
        pWinning = new JPanel();
        pWinning.setLayout(new GridBagLayout());
        gbc = new GridBagConstraints();
        gbc.gridx = 1;
        gbc.gridy = 0;
        gbc.fill = GridBagConstraints.BOTH;
        root.add(pWinning, gbc);
        final ImageButton imageButton1 = new ImageButton();
        imageButton1.setIcon(new ImageIcon(getClass().getResource("/img/main/icon_winning.gif")));
        imageButton1.setPadding(0);
        imageButton1.setUnitedIconHeight(1.0f);
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 0;
        gbc.insets = new Insets(0, 3, 0, 0);
        pWinning.add(imageButton1, gbc);
        final JLabel label2 = new JLabel();
        label2.setText("已通关");
        gbc = new GridBagConstraints();
        gbc.gridx = 1;
        gbc.gridy = 0;
        gbc.anchor = GridBagConstraints.WEST;
        pWinning.add(label2, gbc);
        pPlaying = new JPanel();
        pPlaying.setLayout(new GridBagLayout());
        gbc = new GridBagConstraints();
        gbc.gridx = 2;
        gbc.gridy = 0;
        gbc.fill = GridBagConstraints.BOTH;
        root.add(pPlaying, gbc);
        final ImageButton imageButton2 = new ImageButton();
        imageButton2.setIcon(new ImageIcon(getClass().getResource("/img/main/icon_playing.gif")));
        imageButton2.setPadding(0);
        imageButton2.setUnitedIconHeight(1.0f);
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 0;
        gbc.insets = new Insets(0, 3, 0, 3);
        pPlaying.add(imageButton2, gbc);
        final JLabel label3 = new JLabel();
        label3.setText("游戏中");
        gbc = new GridBagConstraints();
        gbc.gridx = 1;
        gbc.gridy = 0;
        gbc.anchor = GridBagConstraints.WEST;
        pPlaying.add(label3, gbc);
    }

    /**
     * @noinspection ALL
     */
    private Font $$$getFont$$$(String fontName, int style, int size, Font currentFont) {
        if (currentFont == null) return null;
        String resultName;
        if (fontName == null) {
            resultName = currentFont.getName();
        } else {
            Font testFont = new Font(fontName, Font.PLAIN, 10);
            if (testFont.canDisplay('a') && testFont.canDisplay('1')) {
                resultName = fontName;
            } else {
                resultName = currentFont.getName();
            }
        }
        return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
    }

    /**
     * @noinspection ALL
     */
    public JComponent $$$getRootComponent$$$() { return root; }

}
